/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package se.sll.service.catalogue.camel.component.snod;

import org.apache.camel.Component;
import org.apache.camel.Consumer;
import org.apache.camel.MultipleConsumersSupport;
import org.apache.camel.Processor;
import org.apache.camel.Producer;
import org.apache.camel.api.management.ManagedResource;
import org.apache.camel.impl.DefaultEndpoint;
import org.apache.camel.spi.UriEndpoint;
import org.apache.camel.spi.UriParam;
import se.sll.snod.SnodException;

/**
 *
 * @author khaleddaham
 */
@ManagedResource(description = "Managed SnodEndpoint")
@UriEndpoint(scheme = "snod", consumerClass = SnodConsumer.class)
public class SnodEndpoint extends DefaultEndpoint implements MultipleConsumersSupport {
    @UriParam
    private String host;
    @UriParam
    private String port;
    @UriParam
    private String service;
    @UriParam
    private String username;
    @UriParam
    private String password;

    public SnodEndpoint(String uri, Component component) throws SnodException {
        super(uri, component);
    }

    @Override
    public Producer createProducer() throws Exception {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public Consumer createConsumer(Processor processor) throws Exception {        
        Consumer answer = new SnodConsumer(this, processor);
        configureConsumer(answer);
        return answer;
    }

    @Override
    public boolean isSingleton() {
        return true;
    }

    @Override
    public boolean isMultipleConsumersSupported() {
        return true;
    }
}
